home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
DEMO_VGA
/
PLOTFRAC.LZH
/
PLOTFRAC.DOC
< prev
next >
Wrap
Text File
|
1988-02-04
|
13KB
|
215 lines
P L O T F R A C
(A general purpose fractal graphics generator)
Written By
Ronald F. Merts
Copyright (C) 1986, 1987, 1988
Oklahoma Digital Systems
PLOTFRAC is a general purpose program which will plot either the Mandelbrot
Set or the Julia Set of a specified function
F(z) = z^n + c.
The Mandelbrot Set(s) and Julia Set(s) are generated via a feedback loop
function (the actual use for F(z)). That is to say, point k+1 is found using
the k-the value of X and Y for the function F(z). You may ask where did X and
Y come from? Well in the function F(z) the feedback is specified as
z |--> z^n + c
where z = x + iy and c = p + iq. (What is that "i"? That means the "z" and
"c" are actually complex numbers.) If we let the polynomial (function) be of
degree two (2), that is let n = 2 so that we get
F(z) = z^2 + c.
Now if we substitute "x + iy" for "z" and "p + iq" for "c" we get
F(x,y) = (x + iy)^2 + p + iq
= x^2 + 2xyi - y^2 + p + iq.
If you notice the sign in front of "y^2" is minus (-). That is because if
you'll remember i*i = -1. Since we need to separate the function F(z) into
it's real and imaginary parts we get the following
x[k+1] = x[k]^2 - y[k]^2 + p and
y[k+1] = 2*x[k]*y[k] + q.
What happened to the "i"'s? They are not needed by the computer; in fact they
are only there for your benefit...but they are needed when expanding the
polynomial from the (x + iy)^n form to keep the signs correct and to help in
separating the real from the imaginary numbers. After rewriting the original
PLOTFRAC three times to plot three different fractals, I decided to change the
program to have it generate its own "expanded" polynomial. Using the binomial
theorem, I expanded the function (x + y)^n; but now I had to adjust the signs
for the squaring of imaginary numbers. This is not hard at all, since the
signs follow a "++--++--..." pattern; so after the program generates the
polynomial; it simply loops through changing the signs. I had the program all
ready; then I accidentally found out that the Microsoft 'C' pow() function
conflicts with the ROM BIOS graphics interrupts. I am not sure whether this
is due to my "clone" ROM or if it is a problem with the pow function being
used with an 8087 and the ROM BIOS interrupts...the problem first arose after
installing my 8087 math co-processor. That is why there is a pow_r() function
defined and used at the end of PLOTFRAC.
To use the PLOTFRAC program make sure that the two following files
PLOTFRAC.EXE and CWINDOWS.COM are present on the current directory. Then type
PLOTFRAC.
The PLOTFRAC program will load the CWINDOWS program; and then begin executing.
If you have an 8087 or 80287 math co processor, it will be automatically used
by the program; if you do not, then an 8087 emulator routine will be used.
You will not have the speed of an actual 8087; but it will hold the accuracy
to usually within 2 places.
The program will present you with a menu of five options (Plot a Julia Set,
Plot a Mandelbrot Set, Load an old plot, DIRectory of .PIC files and Quit to
DOS). Option 4 will give you a list of all your plots, assuming you have
given them all the three letter extension of .PIC. The PIC files are going to
be the target of the next major update to PLOTFRAC. I will try and include
some sort of convert utility to allow continued use of older plots with newer
versions.
PLOTTING FRACTAL GRAPHS
The main function of this program is to allow you to plot fractal graphics on
your PC. The minimum requirements are:
IBM-PC, PC/AT or compatible (ROM-BIOS MUST be compatible)
Color Graphics Adapter (CGA) or Enhanced Graphics Adapter with
either a Color Monitor (RGB) or Enhanced Color Display (EGA monitor)
256K User available RAM (384K total RAM needed), 512K-640K is
recommended
One, 360K floppy or Hard-drive (recommended)
(Optional) 8087/80287 math co-processor
After selecting which type of fractal to plot, you will be asked for a
filename to save the picture to. I recommend using the three letter extension
of .PIC so that Option 4 from the main menu will work as designed.
Now you must choose the order or "degree" of the feedback polynomial you wish
to use. The most popular is possibly the "z^2 + c" polynomial, but by varying
the degree (the value "n" in the equation F(z) = z^n + c); some interesting
results occur. The entire Mandelbrot set is usually contained within the
region -3...+3 (P_MIN and P_MAX) and -2...+2 (Q_MIN and Q_MAX); likewise the
entire Julia Set is usually contained within the same region (X_MIN...X_MAX
and Y_MIN...Y_MAX). If you are plotting a Julia Set, you will then be asked
to supply the constant values for p and q (from the complex number 'q' in the
polynomial F(z)). Best results are usually obtained when these are near the
boundary of the associated Mandelbrot Set.
Next you will be prompted for the parameters M and K. M is the variable we
set to check and see if our function is escaping toward infinity or
converging. It is usually best set to 100 and left, although satisfactory
results have been obtained with it set at or around 75 or more. K is the
number of colors available on your system. Since the IBM CGA has only 4
colors; this means that our function will only be executed 4 times at most.
This is not at all sufficient, so I recommend you set K at 200. If you have
lowered the value for M, set K to twice the value of M and make sure that it
is divisible by 4 (I.E. if M=75, set K=152). The program will automatically
convert the number to the proper color if necessary.
Lastly you will be asked if you want the plot in 320 X 200, 4-color; 640 X 200
black and white, 320 X 200, 16-color or 640 X 200, 16-color (NOTE: EGA card
required for 16 color plots). The banding patterns can be quite striking; and
you lose these in the 640 X 200 Black and White mode; but the actual
Mandelbrot or Julia Set is more clearly defined.
If you have an math co-processor; your can expect your plot to be completed in
around 45 minutes to 4 hours; depending on the degree of the polynomial and
the difference between X_MIN and X_MAX, Y_MIN and Y_MAX or P and Q MIN and
MAX. The higher the degree or the smaller the difference between the MIN and
MAX; the longer the computational time. If you do not have a math
co-processor; you can expect your plots to be completed in 2 - 12 hours or
more (no kidding).
AFTER THE PLOT IS DONE
After the program has finished plotting your function, or loading an existing
function; you have 6 options available through 7 commands. They are as
follows:
<CR> or <ESC> -- Leave the plot and return to the main menu.
D or d -- Print the current plot on an Epson or Epson compatable
printer (I.E. Epson MX, RX or FX, Seikosha SP-1000).
This function only prints the black region of the plot,
not the associated colors.
C or c -- This function places a black line, starting at column
one (1) and proceeding every-other line (I.E. columns 1,
3, 5, 7, Etc.). This is to allow you to determine new
starting and ending values for the function in the X or
P direction. I am working on a more sophisticated
method of doing this; but until then this will have to
do, and it does work.
H or h -- This function places a black line, horizontally across
the first 25 columns of the screen; starting at line 1
and on each 5th line afterwards (I.E. Line 1, 5, 10,
Etc.). This will allow you to determine new starting
and ending values for Y or Q direction.
B or b -- This function will allow you to change the background
color of the plot to any of the standard CGA colors.
This only works with the 320 X 200 CGA mode plots.
P or p -- This function allows you to switch between the two CGA
mode color palettes (White, Cyan and Violet; or Red,
Green and Yellow). This also only works with the CGA
320 X 200 plots.
OTHER STUFF
This completes the documentation on PLOTFRAC.EXE. The program has been tested
extensively by myself as well as several friends, and it appears as bug-free
as possible. This does not mean it is completely bug-free; but as of yet we
haven't encountered any. The author of the program makes no warranty, implied
or otherwise, as to the functionality of the program. It is provided on an
"as-is" basis; and I will not accept any liability for it's use or misuse. I
am continually trying to make updates and changes to the program, and the new
versions of PLOTFRAC may or may not be compatable with older versions. The
most recent changes have made this version of PLOTFRAC (V2.5) incompatable
with previous versions. This is due to a change I made in the data that is
stored when the plot is saved. This version should remain compatable with the
next version (2.7) of PLOTFRAC; but it may not remain so with subsequent
versions. I will try and include a "convert" utility to allow users to change
older plots to be compatable with new versions; but I won't guarantee there
will be any such programs.
If you have any questions, you may contact me on the White House BBS at
(405) 799-2638 (300/1200/2400 baud, 8-Bits, No Parity, 1 Stop bit); and leave
E-mail or Feedback to user #2.
ADDITIONAL NOTES FOR VERSION 3.0
Version 3.0 now adds support for EGA's 640 X 350 mode with 16 colors available.
Also changed is the routine for handling windows. Previous versions required
NANSI.SYS or NANSI286.SYS for the windows to function properly; this version
will function properly with NANSI.SYS, NANSI286.SYS or ANSI.SYS. This is due
to a change from WINDBIOS.COM, a windowing BIOS extension, to Vitamin-C
libraries. Although this means that full source code is not available, it did
mean full compatability with most IBM and compatable systems. The plotting
worked fine, but the window performance without NANSI.SYS was rather strange.